﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using Serilog;
using Serilog.Events;
using TSNPro.DeviceConfig;
using TSNPro.MyForm;
using TSNPro.Utils;

namespace TSPro
{
    internal static class Program
    {
        static void OnStartup()
        {
            FormLog.GetInstance();
            Console.SetOut(LogTextWriter.GetInstance());
            Console.WriteLine("程序启动成功！");
        }

        static void InitDevice()
        {
            MainDeviceConfig cfg=new MainDeviceConfig();
            cfg.InitIni();
            cfg.InitCommunication();
            cfg.InitDevice();
        }

        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            // 记录日志
            //Log.Information("Hello, Serilog!");
            //Log.Warning("Hello Waring!");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            OnStartup();
            InitDevice();
            
            Application.Run(new FormMain());
        }
    }
}
